package com.zhentao.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhentao.pojo.TRegister;
import com.zhentao.service.TRegisterService;
import com.zhentao.vo.Query;
import com.zhentao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/register")
public class RegisterController {
    @Autowired
    private TRegisterService tRegisterService;


    //多条件查询，模糊查询
    @RequestMapping("/findPage")
    public Result findPage(@RequestBody Query query){
        Page<TRegister> page = tRegisterService.findPage(query);
        return Result.OK(page);
    }


    //查询体检预约记录
    @RequestMapping("/findAll")
    public String findAll(){
        return tRegisterService.list().toString();
    }
    //根据预约时间查询体检预约记录
    @RequestMapping("/findByTime")
    public String findByTime(@RequestParam("yy_time") String time){
        return tRegisterService.list(new QueryWrapper<TRegister>().eq("yy_time", time)).toString();
    }
}
